package com.qianmi.cloud;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Date: 1/19/22 13:51
 * @Created by xiaocai
 */
@RestController
public class TestController {


    @PreAuthorize("hasAuthority('ROLE_ADMIN')")
    @GetMapping("/test")
    public Object get() {
        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        System.out.printf("");
        return "123123";
    }
}
